from spirems import Publisher, def_msg, Logger, CSVLogger, Rate
import time

logger = CSVLogger(['time', 'x', 'y'])
rate = Rate(50)

i = 0
max_t = 0.0
while True:
    try:
        rate.sleep()
        i += 1
        t = time.time()
        logger.append([t, i, i+1])
        if time.time() - t > max_t:
            max_t = time.time() - t
            print(max_t)
    except KeyboardInterrupt:
        logger.quit()
        break
